import { mapGetters } from 'vuex';
import { addedResInform } from '@/api/data/tbNetReport';
export default {
	props: {
		value: { type: Array, default: () => [] },
		data: { type: Array, default: () => [] },
		btnList: { type: Array, default: () => [] }
	},
	data() {
		return {
			checkedResource: [],
			//资源密级
			resourceSecret: ''
		}
	},
	filters: {
		resourceFilterText(data) {
			if (data.isSubmit === 2) {
				return '待提交';
			} else if (data.isLocal === 2) {
				if (data.auditStatus === 4) {
					return '审核中'
				} else if (data.auditStatus === 1) {
					return '已通过';
				} else if (data.auditStatus === 3) {
					return '不通过';
				}
			} else if (data.transcodeStatus === 2) {
				return '转码中';
			} else if (data.transcodeStatus === 3) {
				return '转码失败';
			} else if (data.transcodeStatus === 1) {
				if (data.auditStatus === 4) {
					return '审核中'
				} else if (data.auditStatus === 1) {
					return '已通过';
				} else if (data.auditStatus === 3) {
					return '不通过';
				}
			}
		},

		resourceFilterType(data) {
			if (data.isSubmit === 2) {
				return 'info';
			} else if (data.isLocal === 2) {
				if (data.auditStatus === 4) {
					return 'warning'
				} else if (data.auditStatus === 1) {
					return 'success';
				} else if (data.auditStatus === 3) {
					return 'danger';
				}
			} else if (data.transcodeStatus === 2) {
				return 'warning';
			} else if (data.transcodeStatus === 3) {
				return 'danger';
			} else if (data.transcodeStatus === 1) {
				if (data.auditStatus === 4) {
					return 'warning'
				} else if (data.auditStatus === 1) {
					return 'success';
				} else if (data.auditStatus === 3) {
					return 'danger';
				}
			}
		}
	},
	computed: {
		...mapGetters(['siteInfo', 'dictEnums']),
		fullPath() {
			return this.$route.fullPath;
		},
		resourceListData() {
			let fileArr = this.data.filter((item) => item.isFolder === 2);
			let folderArr = this.data.filter((item) => item.isFolder === 1);

			console.log(fileArr);
			return [
				/* ...folderArr.sort((a, b) => this.$sortNumberEnZh(a.oldName, b.oldName, true)),
				...fileArr.sort((a, b) => this.$sortNumberEnZh(a.oldName, b.oldName, true)) */
			];
		}
	},
	watch: {
		value(arr) {
			this.checkedResource = arr;
		}
	},
	mounted() {

	},
	methods: {
		//进入详情
		handleToDetail(data) {
			if (data.isFolder === 1) {
				this.$router.push({ path: this.fullPath, query: { folder: data.id } });
			} else {
				let routeData = this.$router.resolve({
					path: '/data/resource/' + data.id
				});
				window.open(routeData.href, '_blank');
			}
		}
	}
}